<!doctype html>
<html lang="en">
<head>
    @include('web.layout.head')
    <link rel="stylesheet" href="{{asset('/css/web/user/match_order.css')}}">
</head>
<body>
@include('web.layout.header')
@include('web.layout.user_tab')
<div class="base_member_content">
    <div class="w1200">
        @include('web.layout.buyer_nav')
        <div class="nav_right flr">
            <div class="base_content">
                <div class="line_title">我的配单</div>
                <div class="my-subnav f-cb">
                    <ul>
                        <li class="{{empty(array_get($search_params, 'order_status')) ? 'cur': ''}}"><a href="{{asset('/member/buyer/items')}}" class="jm_hover" >所有配单</a><i></i></li>
                        <li  class="{{$search_params['order_status']==1 ?  'cur':''}}"><a href="{{asset('/member/buyer/items?order_status=1')}}" class="jm_hover">已报价</a><i></i></li>
                        <li class="{{is_array($search_params['order_status']) ? 'cur': ''}}"><a href="{{asset('/member/buyer/items?order_status[]=2&order_status[]=3&order_status[]=4')}}" class="jm_hover">已完成</a><i></i></li>
                        <li class="{{$search_params['order_status']==5 ? 'cur':'' }}"><a href="{{asset('/member/buyer/items?order_status=5')}}" class="jm_hover">已关闭</a><i></i></li>
                    </ul>
                    <div class="search">
                        <input name='order_code' type="text" class="text fl" placeholder="配单编号" value='{{array_get($search_params, 'order_code')}}' />
                        @if(!is_array($search_params['order_status']))
                            <input name='order_status' type="hidden" class="" id="order_status" value='{{$search_params['order_status']}}' />
                        @else
                            <input name='order_status[]' type="hidden" class="" value='2' />
                            <input name='order_status[]' type="hidden" class="" value='3' />
                            <input name='order_status[]' type="hidden" class="" value='4' />
                            <input  type="hidden" class="" id="order_status" value='2' />
                        @endif

                        <input type="submit" class="submit fr" value="查询" />
                    </div>
                </div>
                <div class="content">
                    <div class="order_item_box">
                        <?php if(!empty($list)){ foreach ($list as $k => $v) { ?>
                        <div class="order_item">
                            <div class="order_item_top">
                                <div class="wait_word fl">
                                    <div class="wait">
                                        @if($v['order_status']==1)
                                           已报价
                                       @elseif($v['order_status']==2)
                                           付款完成
                                       @elseif($v['order_status']==3)
                                           已发货
                                       @elseif($v['order_status']==4)
                                           确认完成
                                       @elseif($v['order_status']==5)
                                           已关闭
                                       @endif
                                    </div>
{{--                                    {{$v['quote_contain']}}--}}
                                    <div class="word">配单编号：{{$v['order_code']}} |  创建时间：{{$v['created_at']}} |
                                        @if(in_array(1,$v['items_information']['quote_contain']))
                                            含税
                                        @elseif(in_array(2,$v['items_information']['quote_contain']))
                                            含运费
                                        @elseif(in_array(3,$v['items_information']['quote_contain']))
                                            含施工安装
                                        @elseif(in_array(4,$v['items_information']['quote_contain']))
                                            含公报总价
                                        @endif
                                    </div>
                                </div>
                                <div class="total flr">合计金额：<span>{{$v['order_money']}}</span> 元</div>
                            </div>
                            <div class="order_item_bot">
                                <div class="word fl">服务专员:{{$v['items_information']['seller_phone']}}（{{$v['items_information']['seller_contact']}}）</div>
                                <?php if(0==$v['order_status'] || 1==$v['order_status'] || 2==$v['order_status'] || 3==$v['order_status']){?>
                                    <a href="{{asset('/member/buyer/items')}}/{{$v['items_information']['id']}}" target="_blank" class="jm_btn5 flr">立即查看</a>
                                <?php } ?>
                            </div>
                        </div>
                        <?php }}else{?>
                        <div class="order_item">暂无数据</div>
                        <?php } ?>
                    </div>
                </div>
                <div class="page">
                    @include('web.common.paginate', ['page' => $page])
                </div>
            </div>
        </div>
    </div>
</div>
@include('web.layout.footer')
<script>
    $(function () {
        $(".js-remove").click(function () {
            var $this = $(this), cid = $this.data('id');
            var token = $(".base_content").find('input[name="_token"]').val();
            $.post('/buyer/coupon_remove', {_token: token, id: cid}, function (res) {
                if (res.err == 0){
                    $this.parents('.coupon_item').remove();
                } else {
                    $.MsgBox.Alert("温馨提示", res.errmsg);
                }
            }, 'json')
        });
        $(".submit").on('click', function(event) {
            event.preventDefault();
            /* Act on the event */
            var text = $(".text").val();
            var order_status=$("#order_status").val();
            if(order_status==2)
            {
                location.href = '/member/buyer/items?order_code=' + text+'&order_status[]=2&order_status[]=3&order_status[]=4';
            }else{
                location.href = '/member/buyer/items?order_code=' + text+'&order_status='+order_status;
            }
        });
    })
</script>
</body>
</html>